/*
client_verbs.dm
Yes, they are named differently on purpose.
All of the basic verbs used by everyone, talking, and icon changing, whatnot.
*/

client
	verb
		get()
			for(var/obj/gettable/o in oview(0,mob))
				o.get(mob)
			var/mob/player/p = mob
			p.update_contents()

		send_file()
			var/list/clients=list()
			for(var/client/c)
				if(c!=src) clients += c

			if(!clients.len)
				src << "There is no one to send a file to."
				return

			var/f = input("Which file would you like to send?") as null|file
			if(!f)return
			var/c = input("Who would you like to send the file to?") in clients+"Cancel"

			if(c=="Cancel")return

			if(alert(c, "[src] is trying to send you [f]. Accept?","File Receive","Yes","No")=="Yes")
				c << ftp(f)

		//tell me who's online
		who()
			var i
			src << ""
			src << "Online Players:"
			for(var/client/c)
				++i
				src << "[c.mob.name], the level [c.mob.classlvl[c.mob.class]] [c.mob.class] ([c.key])"
			src << "----[i] player\s online----"

		//change to a new icon - do a bit more with this
		changeIcon(f as icon)
			mob.icon_state = input(src,"What icon_state?") in icon_states(f)
			mob.icon = f
			mob.iconFile="icons_custom/[ckey]/[f]"
			fcopy(f,"icons_custom/[ckey]/[f]")

		//this is for the button that chooses where your saying messages go
		swapsay()
			if(winget(src,"main.ss","text")=="Say")
				winset(src,"main.ss","text=W-Say")
				winset(src,"main.chat","command=wsay")
			else
				winset(src,"main.ss","text=Say")
				winset(src,"main.chat","command=say")

		//say to oview()
		say(t as text)
			if(t=="/admin" && ckey in admins)
				winshow_center(src,"admin")
				return

			if(false_text(t))return

			if(muted)
				src << t
				spawn(600)
					if(muted)muted=0
				return

			if(length(t)>400)
				src << "You cannot have a message that long."
				return

			view() << "\[Local\] [adminMode ? "\[AdminMode\] " : ""]<b>[mob.name]</b>: [html_encode(t)]</font>"

		//say to the whole world
		wsay(t as text)
			if(t=="/admin" && ckey in admins)
				winshow_center(src,"admin")
				return
			if(false_text(t))return

			if(muted)
				src << t
				spawn(600)
					if(muted)muted=0
				return

			if(length(t)>400)
				src << "You cannot have a message that long."
				return


			if(talked>=SPAM_AMOUNT)
				muted=TRUE
				src << t
				return
			talked++
			spawn(17)talked--
			world << "\[World\] [adminMode ? "\[AdminMode\] " : ""]<b>[mob.name]</b>: [html_encode(t)]</font>"

